package com.weic.manager.config;

import com.weic.manager.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截所有请求
        InterceptorRegistration ir = registry.addInterceptor(new LoginInterceptor());
        // /xx.xx的后缀需要使用/**来匹配，使用/*.*无效
        ir.addPathPatterns("/**").excludePathPatterns("/**/logout.do");
    }
}
